import { createStore } from "vuex";
import { CHANGE_PAGE } from "./types";

export default createStore({
  state: {
    page: 1,
  },
  mutations: {
    [CHANGE_PAGE](state, payload) {
      state.page = payload.page;
    },
  },
  actions: {
    [CHANGE_PAGE](context, payload) {
      context.commit(CHANGE_PAGE, payload);
    },
  },
  modules: {},
  getters: {
    getPage(state) {
      return state.page;
    },
  },
});
